package ru.rchervot.sanasar.client.view;

import ru.rchervot.sanasar.client.event.EventVisibilityFiltersCompanies;
import ru.rchervot.sanasar.client.event.HandlerVisibilityFiltersCompanies;
import ru.rchervot.sanasar.client.model.FactoryQuery;
import ru.rchervot.sanasar.client.rpc.RPCServiceAsync;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerManager;

public class SearchBoxCompaniesPresenter extends AbstractSearchBoxPresenter {

	public interface Display extends AbstractSearchBoxPresenter.Display {}
	
	public SearchBoxCompaniesPresenter(Display display, HandlerManager eventBus,
			RPCServiceAsync service, 
			FactoryQuery factoryQuery) {
		super(display, eventBus, service, factoryQuery);
	}

	
	@Override
	protected GwtEvent<?> getFiltersShowEvent() {
		return new EventVisibilityFiltersCompanies(true);
	}
	
	@Override
	protected void addHandlerFiltersVisibility() {
		eventBus.addHandler(EventVisibilityFiltersCompanies.TYPE,
				new HandlerVisibilityFiltersCompanies() {
			public void onVisibilityChange(EventVisibilityFiltersCompanies event) {
				setVisibleFilters(event.getVisibility());
			}
		});
	}
	
}
